##########################################
# REPLICATION OF: 
#
# Coup-Proofing: Latent Concept and Measurement
#
# Political Science Research and Methods
#
# By Hwalmin Jin, December, 2023
#
# Contact: jymh33@gmail.com
##########################################


** Introduction

This replication directory contains all analysis files to replicate results and figures in the article. 

Please run the file "replication_psrm_coup_proofing_revised_1112.R" for IRT estimation, Figure 1 (main manuscript and appendix), Figure 3, and 4 (appendix). 
It will load all data, source all files, and install all required packages. 

Please run the file "psrm_irt_replication_1312.do" for Figure 2, 3, 4, 5, 6, 7 (main manuscript), Figure 2 (appendix), Table 2 (main manuscript), and Table 2 and 3 (appendix). 
It will load all data, source all files, and install all required packages.

Please see below for the mapping of figure and table filenames to numbers in the article and appendix. 

1. R files 
"replication_psrm_coup_proofing.R": R command (R studio) file for estimating IRT coup-proofing
"irt_base_coup_full.csv": The base csv file for estimating IRT coup-proofing (main 2PL model and normal prior (0,10) model) 
"irt_base_coup_full_exclude.csv": The base csv file for estimating IRT coup-proofing (exclude civilian elites in foreign affairs position, justice, and non-security cabient posts model)
"fitted_coup_proofing.csv": estimated latent coup-proofing (main model)
"fitted_coup_proofing_1.csv": estimated latent coup-proofing (normal prior (0,10) model)
"fitted_coup_proofing_exclude.csv": estimated latent coup-proofing (exclude civilian elites in foreign affairs position, justice, and non-security cabient posts model)
"coup_proofing_rdata_psrm.RData": save file for main 2PL model 
"easiness_static_figure1(a).pdf": Figure 1(a) in the main manuscript 
"discrimination_static_figure1(b).pdf": Figure 1 (b) in the main manuscript
"easiness_exclude_static_figure1(a)appendix.pdf": Figure 1(a) in the appendix
"discrimination_exclude_static_figure1(b)appendix.pdf": Figure 1(b) in the appendix
"Rhat_figure3appendix.pdf": Figure 3 in the appendix
"Rplot_figure4appendix.pdf": Figure 4 in the appendix
"psrm_irt_logfile_R.txt": log file of IRT estimation

2. Stata files

"psrm_irt_replication_0902.dta": The base dta file for replicating the figures and tables in the maintext and appendix
"psrm_irt_replication_0902.do": A base do file for replicating the figures and tables in the maintext and appendix
"mean_coup_proofing_figure2.gph": Figure 2 in the main manuscript
"mean_coup_proofing_figure3_gwfmilitary.gph": Figure 3 (a) in the main manuscript
"mean_coup_proofing_figure3_gwfparty.gph": Figure 3 (b) in the main manuscript
"mean_coup_proofing_figure3_gwfpersonal.gph": Figure 3 (c) in the main manuscript
"mean_coup_proofing_figure3_gwfmonarchy.gph": Figure 3 (d) in the main manuscript
"mean_coup_proofing_figure4_pakistan.gph": Figure 4 (a) in the main manuscript
"mean_coup_proofing_figure4_mexico.gph": Figure 4 (b) in the main manuscript
"heat_plot_extent_coup_proofing_figure5.gph": Figure 5 in the main manuscript
"coup_proofing_and_civilian_control_figure6_left.gph": Figure 6 in the main manuscript
"coup_proofing_and_power_consolidation_figure6_right.gph": Figure 6 in the main manuscript
"guatemala_coup_proofing_figure7.gph": Figure 7 in the main manuscript
"heat_plot_extent_coup_proofing_exclude_figure2appendix.gph": Figure 2 in the appendix
"psrm_irt_logfile_Stata.txt": log file of stata commands

